function winOpen (strURL,strName,width,height)
{
    theWindow = window.open (strURL,strName,"width="+width+", height="+height+", scrollbars=yes, left="+(screen.width-width)/2+", top="+(screen.height-height)/2);	
}
//书籍Logo上传
 function openFileUploadWindow() {
	var urlpath = "/control/book/upload_uploadUI.go";
	winOpen(urlpath, "图片上传", 550, 130);
}
 function openShopLogoWindow(){
	 var urlpath = "/control/book/upload_shopLogo.go";
	winOpen(urlpath, "图片上传", 550, 130);
 }
 function showLogo(id){
	 var imgPath=document.getElementById(id).value;
	 document.getElementById("shopLogo").src=imgPath;
	 alert(imgPath);
 }
 
 function opentTypeList(){
	 window.open ('/control/book/type_bookType.go','newwindow','height=250,width=500,top='+(screen.height-300)/2+',left='+(screen.width-500)/2+',toolbar=no,menubar=no,titlebar=no,scrollbars=yes, resizable=no,location=no, status=no'); 
 }
 function openOrderItem(orderid){
	 window.open ('/control/book/order_item.go?orderid='+orderid+'','newwindow','height=250,width=500,top='+(screen.height-300)/2+',left='+(screen.width-500)/2+',toolbar=no,menubar=no,titlebar=no,scrollbars=yes, resizable=no,location=no, status=no');
 }
 function SelectAll(tempControl) {
     var theBox = tempControl;
     xState = theBox.checked;
     elem = theBox.form.elements;
     for(var i = 0; i < elem.length;i++) {
         if(elem[i].type == "checkbox") {
             if(elem[i].checked != xState) {
                 elem[i].click();
             }
         }
     }
 }

 
 function changeCenter(urlPath,dataAction,div){
	 $.ajax({
		   type: "POST",
		   url: urlPath,
		   data: dataAction,
		   success: function(html){
		     $(div).html(html);
		     changeEdit();
		   }
	});
 }
 /**完整按钮表：
 |：分隔符
 /：强制换行
 Cut：剪切
 Copy：复制
 Paste：粘贴
 Pastetext：文本粘贴
 Blocktag：段落标签
 Fontface：字体  
 FontSize：字体大小
 Bold：粗体
 Italic：斜体
 Underline：下划线
 Strikethrough：中划线
 FontColor：字体颜色
 BackColor：字体背景色
 SelectAll：全选
 Removeformat：删除文字格式
 Align：对齐
 List：列表
 Outdent：减少缩进
 Indent：增加缩进
 Link：超链接
 Unlink：删除链接
 Anchor：锚点
 Img：图片
 Flash：Flash动画
 Media：Windows media player视频
 Hr：插入水平线
 Emot：表情
 Table：表格
 Source：切换源代码模式
 Preview：预览当前代码
 Print：打印
 Fullscreen：切换全屏模式
 About：关于xhEditor
 **/
 function changeEdit(){
 	$("#author_study,#author_synopsis").xheditor({tools:'Cut,Copy,Paste,Pastetext,|,Blocktag,Fontface,FontSize,Bold,Italic,Underline,Strikethrough,FontColor,BackColor,SelectAll,Removeformat,|,Align,List,Outdent,Indent,|,Link,Unlink,Anchor,Hr,Emot,Table,|,Preview',skin:'default'});
 }
 
 /**
  * div 回调显示区域
  * form 提交的Form表单
  * */
 function ajaxFormSubmit(div,form){
 	 $(form).ajaxSubmit(function(responseText) { 
          $(div).html(responseText);
      }); 
 }
 /*改变状态和类型*/
 function chengStateType(flag,type,state){
	 $("#book_flag").val(flag);
	 $("#book_type").val(type);
	 $("#book_state").val(state);
	 ajaxFormSubmit("#right_content_sell","#update_book_state");
 }
 /*店铺注册*/
 function registerShop(){
	 if(FCKeditor_OnComplete('test')){
		 ajaxFormSubmit('#right_content_sell','#register_shop_form');
	 }
 }